package xyz.ljcc.ccmt.repository.admin;

import java.util.List;

import org.springframework.data.jpa.repository.Query;

import xyz.ljcc.ccmt.commons.repository.base.BaseRepository;
import xyz.ljcc.ccmt.model.base.PatMasterInfor;
import xyz.ljcc.ccmt.model.vo.PatientMasterInfoVo;

public interface PatMasterInforRepository extends BaseRepository<PatMasterInfor, Integer> {

	/**
	 * 根据科室号获取对应的患者数据
	 * @param deptCode
	 * @return
	 */
	@Query(" select new xyz.ljcc.ccmt.model.vo.PatientMasterInfoVo(p.patientId,p.inpNo,"
			+ "p.visitId,p.deptCode,p.deptName,p.admissionTime,p.admdeptTime,p.bedNo,p.bedLabel,"
			+ "p.nurseClass,p.status,p.nurseId,p.nurseName,p.doctorId,p.doctorName,"
			+ "o.patientName,o.patientSex,o.birthDate,o.address,o.phone)"
			+ " from PatInHospital p,PatMasterInfor o "
			+ " where p.patientId = o.patientId and p.deptCode = ?1 "
			+ " order by p.bedNo ")
	List<PatientMasterInfoVo> loadPatientList(String deptCode);
	
}
